package cn.lili.modules.config;

import com.api.PayApi;
import com.api.UserApi;
import com.api.UserShareApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@RefreshScope
public class FySdkConfig {

    @Value("${fw.secrect}")
    String secret;

    @Value("${fw.appid}")
    String appId;

    @Value("${fw.secrect_share}")
    String secretShare;

    @Value("${fw.appid_share}")
    String appIdShare;


    @Value("${fw.server_wallet}")
    String serverWallet;

    @Value("${fw.server_backend}")
    String serverBackend;

    @Bean
    public UserApi userApi() {
        UserApi userApi = new UserApi();
        userApi.init(serverBackend, appId, secret);
        return userApi;
    }


    @Bean
    public PayApi payApi() {
        PayApi userApi = new PayApi();
        userApi.init(serverWallet, appId, secret);
        return userApi;
    }

    @Bean
    public UserShareApi userShareApi() {
        UserShareApi userShareApi = new UserShareApi();
        userShareApi.init(serverBackend, appIdShare, secretShare);
        return userShareApi;
    }

}